import {reactive, watch} from "vue";
import type Breadcrumb from "@/domain/po/Breadcrumb";
import {defineStore} from "pinia";

export const useBreadcrumbStore = defineStore("breadcrumbStore", () => {
    const breadcrumbList = reactive(new Array<Breadcrumb>());

    /**
     * 清理数组
     */
    function clear() {
        breadcrumbList.length = 0;
    }

    /**
     * 添加内容
     */
    function add(item: Breadcrumb) {
        breadcrumbList.push(item);
    }

    /**
     * 获取内容
     */
    function get() {
        return breadcrumbList;
    }

    return {
        clear,
        add,
        get,
    }
})